aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/groups/[groupId]/expenses/page.tsx
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2024-01-29 22:37:13 -0500
committerSebastien Castiel <sebastien@castiel.me>2024-01-30 12:57:21 -0500
commit9e300e0ff0c9d93cbaeaa86c1e2a560523107382 (patch)
treeebeaea60117fbac781a415e3299395f3f8e637d7 /src/app/groups/[groupId]/expenses/page.tsx
parent3847a67a192a04098643e19953549a99ca152b8a (diff)
Use React’s cache to avoid some queries to the database
Diffstat (limited to 'src/app/groups/[groupId]/expenses/page.tsx')
-rw-r--r--src/app/groups/[groupId]/expenses/page.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/app/groups/[groupId]/expenses/page.tsx b/src/app/groups/[groupId]/expenses/page.tsx
index 27f411a..0c36166 100644
--- a/src/app/groups/[groupId]/expenses/page.tsx
+++ b/src/app/groups/[groupId]/expenses/page.tsx
@@ -1,3 +1,4 @@
+import { cached } from '@/app/cached-functions'
import { ActiveUserModal } from '@/app/groups/[groupId]/expenses/active-user-modal'
import { ExpenseList } from '@/app/groups/[groupId]/expenses/expense-list'
import { Button } from '@/components/ui/button'
@@ -9,13 +10,15 @@ import {
CardTitle,
} from '@/components/ui/card'
import { Skeleton } from '@/components/ui/skeleton'
-import { getGroup, getGroupExpenses } from '@/lib/api'
+import { getGroupExpenses } from '@/lib/api'
import { Download, Plus } from 'lucide-react'
import { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { Suspense } from 'react'
+export const revalidate = 3600
+
export const metadata: Metadata = {
title: 'Expenses',
}
@@ -25,7 +28,7 @@ export default async function GroupExpensesPage({
}: {
params: { groupId: string }
}) {
- const group = await getGroup(groupId)
+ const group = await cached.getGroup(groupId)
if (!group) notFound()
return (
@@ -84,7 +87,7 @@ export default async function GroupExpensesPage({
}
async function Expenses({ groupId }: { groupId: string }) {
- const group = await getGroup(groupId)
+ const group = await cached.getGroup(groupId)
if (!group) notFound()
const expenses = await getGroupExpenses(group.id)